<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
  //   function sumScores(arr = []){
  //     let sum=0
  //     for (let i = 0; i<arr.length; i++){
  //       sum += arr[i]
  //   }
  //   console.log(sum)
  //   document.write(sum)
  // }
  // sumScores([24,51,45,56]
  let num1=+prompt('请输入第一个数字')
  let num2=+prompt('请输入第二个数字')
  function fn (num1,num2){
    let sum = 0
    for (let i = num1; i<=num2; i++){
      sum +=i
    }
    document.write(sum)
  }

  //fn(50,100)
  let a = +prompt()
  let b = +prompt()
  fn (a,b)
  //fn(+prompt('1'),+prompt('2'))

function fn( arr = []){
  let sum = 0
  for(let i = 0;i<arr.lenght;i++){
    sum += arr[i]
  }
  document.write(sum)
}
fn([10,20,30])


  </script>
</body>
</html>